﻿package mortal.common.error
{
    import Engine.error.*;
    import extend.language.*;
    import flash.utils.*;
    import mortal.game.resource.*;

    public class ErrorCode extends Object
    {
        public static const ErrorLogin_NoRole:int = 32001;
        public static const ErrorCell_FightToEntityNotOnline:int = 38006;
        public static const ErroeCell_CollectToEntityNotOnline:int = 38050;
        public static const ErrorCell_ModeSetPeaceModeCdError:int = 38031;
        public static const ErrorPublic_CopyGroupNotExsit:int = 31255;
        public static const ErrorPublic_PlayerNotOnline:int = 40001;
        public static const ErrorCell_EscortIsAttacked:int = 38105;
        public static const ErrorCell_ObstructNotFight:int = 38034;
        public static const ErrorCell_CollectHasOwner:int = 38052;
        public static const ErrorGate_ZazenPlayerReject:int = 35852;
        public static const ErrorCell_FightTooFar:int = 38005;
        public static const ErrorCell_SkillTooFar:int = 38082;
        public static const ErrorCell_CollectDistanceTooFar:int = 38056;
        public static const ErrorCell_InputPointError:int = 38024;
        public static const ErrorGate_TransportHadTask:int = 35484;
        public static const ErrorGate_BagBagIsFull:int = 35340;
        public static const ErrorGate_BagSlotNotEnough:int = 35341;
        public static const ErrorGate_FriendFriendAmountLimite:int = 35267;
        public static const ErrorPublic_CannotGetPetCpnReward:int = 31686;
        public static const ErrorPublic_SkillCDNotEnd:int = 34056;
        public static const ErrorPublic_BossTooFar:int = 34061;
        public static const ErrorPublic_CollectStoped:int = 36283;

        public function ErrorCode()
        {
            return;
        }// end function

        public static function init() : void
        {
            new RMIErrorCode();
            initRMIError();
            new SystemErrorCode();
            initSystemErroe();
            return;
        }// end function

        public static function getErrorStringByCode(param1:int) : String
        {
            if (SystemErrorCode.isInError(param1))
            {
                return SystemErrorCode.getErrorByCode(param1);
            }
            if (RMIErrorCode.isInError(param1))
            {
                return RMIErrorCode.getErrorByCode(param1);
            }
            return ErrorCodeConfig.instance.getErrorStringByCode(param1);
        }// end function

        public static function getErrorByLogin(param1:int) : String
        {
            if (SystemErrorCode.isInError(param1))
            {
                return SystemErrorCode.getErrorByCode(param1);
            }
            if (RMIErrorCode.isInError(param1))
            {
                return RMIErrorCode.getErrorByCode(param1);
            }
            return param1 + "";
        }// end function

        private static function initRMIError() : void
        {
            var _loc_1:* = RMIErrorCode.map;
            _loc_1[RMIErrorCode.ExceptionCodeRMI] = PreLanguage.getString(127);
            _loc_1[RMIErrorCode.ExceptionCodeNotSupported] = PreLanguage.getString(128);
            _loc_1[RMIErrorCode.ExceptionCodeInvoke] = PreLanguage.getString(129);
            _loc_1[RMIErrorCode.ExceptionCodeTimeOut] = PreLanguage.getString(130);
            _loc_1[RMIErrorCode.ExceptionCodeConnectionNotConnect] = PreLanguage.getString(131);
            _loc_1[RMIErrorCode.ExceptionCodeConnectionClosed] = PreLanguage.getString(132);
            _loc_1[RMIErrorCode.ExceptionCodeConnectionWrite] = PreLanguage.getString(133);
            _loc_1[RMIErrorCode.ExceptionCodeObjectNotExist] = PreLanguage.getString(134);
            _loc_1[RMIErrorCode.ExceptionCodeOperationNotExist] = PreLanguage.getString(135);
            _loc_1[RMIErrorCode.ExceptionCodeNotInstantiation] = PreLanguage.getString(136);
            _loc_1[RMIErrorCode.ErrorDb_PlayerIdError] = PreLanguage.getString(137);
            _loc_1[RMIErrorCode.ErrorDb_PlayerCreateUserNameExsit] = PreLanguage.getString(138);
            _loc_1[RMIErrorCode.ErrorDb_PlayerCreateRoleNameExsit] = PreLanguage.getString(139);
            _loc_1[RMIErrorCode.ErrorLogin_NeedLoginFromPlatform] = PreLanguage.getString(140);
            _loc_1[RMIErrorCode.ErrorLogin_NoRole] = PreLanguage.getString(141);
            _loc_1[RMIErrorCode.ErrorLogin_RoleNameIsToLong] = PreLanguage.getString(142);
            _loc_1[RMIErrorCode.ErrorLogin_CreateRoleNameError] = PreLanguage.getString(143);
            _loc_1[RMIErrorCode.ErrorLogin_CreateRoleDataError] = PreLanguage.getString(144);
            _loc_1[RMIErrorCode.ErrorLogin_UserNameError] = PreLanguage.getString(145);
            _loc_1[RMIErrorCode.ErrorGate_LoginNotLogin] = PreLanguage.getString(146);
            _loc_1[RMIErrorCode.ErrorGate_LoginIsLogin] = PreLanguage.getString(147);
            _loc_1[RMIErrorCode.ErrorGate_OperNotCD] = PreLanguage.getString(148);
            _loc_1[RMIErrorCode.ErrorLogin_ErrorCodeVersion] = PreLanguage.getString(149);
            return;
        }// end function

        private static function initSystemErroe() : void
        {
            var _loc_1:* = SystemErrorCode.map;
            _loc_1[SystemErrorCode.ExceptionCodeUnkown] = PreLanguage.getString(116);
            _loc_1[SystemErrorCode.ExceptionOutOffMemery] = PreLanguage.getString(117);
            _loc_1[SystemErrorCode.ExceptionCodeBase] = PreLanguage.getString(118);
            _loc_1[SystemErrorCode.ExceptionCodeStd] = PreLanguage.getString(119);
            _loc_1[SystemErrorCode.ExceptionCodeDateTime] = PreLanguage.getString(120);
            _loc_1[SystemErrorCode.ExceptionCodeFunction] = PreLanguage.getString(121);
            _loc_1[SystemErrorCode.ExceptionCodeNullHandle] = PreLanguage.getString(122);
            _loc_1[SystemErrorCode.ExceptionCodeDB] = PreLanguage.getString(123);
            _loc_1[SystemErrorCode.ExceptionCodeSerialize] = PreLanguage.getString(124);
            _loc_1[SystemErrorCode.ExceptionCodeLang] = PreLanguage.getString(125);
            _loc_1[SystemErrorCode.ExceptionCodeXml] = PreLanguage.getString(126);
            return;
        }// end function

    }
}
